package info.motteke.mixivoice4j.http.json.favorite.delete;

import info.motteke.mixivoice4j.Entry;
import info.motteke.mixivoice4j.User;
import info.motteke.mixivoice4j.http.json.JsonRequestBuilder;

public class DeleteFavoriteBuilder extends JsonRequestBuilder<DeleteFavoriteRequest> {

    private Entry entry = null;

    private User favoriteUser = null;

    private User viewer = null;

    protected DeleteFavoriteBuilder() {

    }

    public DeleteFavoriteBuilder entry(Entry entry) {
        this.entry = entry;
        return this;
    }

    public DeleteFavoriteBuilder favoriteUser(User user) {
        this.favoriteUser = user;
        return this;
    }

    public DeleteFavoriteBuilder viewer(User user) {
        this.viewer = user;
        return this;
    }

    @Override
    public DeleteFavoriteRequest build() {
        check(entry, "entry");
        check(favoriteUser, "favoriteUser");
        check(viewer, "viewer");

        DeleteFavoriteRequest req = new DeleteFavoriteRequest();
        DeleteFavoriteParam p = req.getParams();
        p.setEntryId(entry.getId());
        p.setOwnerId(entry.getUser().getId());
        p.setFavoriteUserId(favoriteUser.getId());
        p.setViewerId(viewer.getId());

        return req;
    }

}